﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="main.aspx.cs" Inherits="ZX.WebApp.DeskTop.main" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../Styles/deskTopStyle.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="../Scripts/json2.js" type="text/javascript"></script>
    <script type="text/javascript">

        function load() {
            var _defalut = document.getElementById("divDefault");
            if (_defalut != undefined) {
                _defalut.style.display = 'block';
            }
        }
        $(function () {
            $(".ClassFromCRM").live("click", function () {
                var cobj = $(this);
                var km_index = cobj.attr("KmIndex");
                var _data = cobj.attr("CRMObj");
                window.open(km_index + "?KM_DATA=" + _data);
            });
        });
        //显示或隐藏
        function doShow(obj) {
            if (!obj) return;
            try {
                var objP = obj.parentNode.parentNode.parentNode.childNodes[1];
                //var iLen = objP.childNodes.length;

                var objTmp;

                if (obj.src.indexOf('collapse.gif') >= 0) {
                    obj.src = '../Images/icon/expend.gif';

                    //for (i = iLen - 1; i > 0; i--) {
                    objP.style.display = 'none';
                    //}
                }
                else {
                    obj.src = '../Images/icon/collapse.gif';
                    objP.style.display = '';
                }
            }
            catch (ex) {
                alert(ex.message);
            }
        }

        //切换显示
        function exchangeNodes() {
            var aryImg = document.getElementsByName('imgShow');
            for (var i = 0; i < aryImg.length; i++) {
                doShow(aryImg[i]);
            }
        }


        //expend all
        function expandNodes() {
            var aryImg = document.getElementsByName('imgShow');
            for (var i = 0; i < aryImg.length; i++) {
                if (aryImg[i].src.indexOf('collapse.gif') >= 0) continue;
                doShow(aryImg[i]);
            }
        }


        //collapse all
        function collapseNodes() {
            var aryImg = document.getElementsByName('imgShow');
            for (var i = 0; i < aryImg.length; i++) {
                if (aryImg[i].src.indexOf('expend.gif') >= 0) continue;
                doShow(aryImg[i]);
            }
        }

        var index = 0;
        var tempObjectArray;
        var Execution = function (obj) {
            tempObjectArray = obj;
            var src = obj[index].SRC;
            var id = obj[index].UserDesktopID;
            var pageType = obj[index].PageType;
            GetReportData(src, id, pageType);
        };

        function GetReportData(url, obj, pageType, d) {
            var pageName = "";
            var tempUrl = url.split("/");
            for (var j = 0; j < tempUrl.length; j++) {
                var value = tempUrl[j];
                if (value.indexOf('.aspx') > 0) {
                    //ChanelTypeReport.aspx?PowerType=0
                    pageName = value.split(".aspx")[0];
                }
            }
            var tUrl = url;
            if (url.indexOf("?") > 0) {
                url = url + "&r=" + Math.random();
            } else {
                url = url + "?r=" + Math.random();
            }
            var params;
            if (d != null && d != undefined)
                params = { "obj": obj, "url": tUrl, "pageType": pageType, "dataType": d };
            else
                params = { "obj": obj, "url": tUrl, "pageType": pageType, "r": Math.random() };
            $.ajax({
                type: "get",
                url: url,
                data: params,
                beforeSend: function (XMLHttpRequest) {
                    $("#f_" + obj).show();
                },
                success: function (data, textStatus) {
                    if (pageType == "0") {
                        $("#data_" + obj).html("");
                        $("#data_" + obj).append(data);
                    }
                    else {
                        $("#data_" + obj).html("");
                        var iframe = "<iframe src='" + url + "&obj=" + obj + "&pageType=" + pageType + "' frameBorder=0 scrolling=no height='100%' width='100%'></iframe>";
                        $("#data_" + obj).append(iframe);
                    }
                    if (index < tempObjectArray.length - 1) {
                        index++;
                        GetReportData(tempObjectArray[index].SRC, tempObjectArray[index].UserDesktopID, tempObjectArray[index].PageType);
                    }
                },
                complete: function (XMLHttpRequest, textStatus) {
                    $("#f_" + obj).hide();
                    $("." + pageName).css("color", "");
                    if (d == undefined || d == "") {
                        $("#0_" + pageName).css("color", "red");
                    } else {
                        $("#" + d + "_" + pageName).css("color", "red");
                    }
                },
                error: function () {
                    //请求出错处理
                    alert("出错")
                }
            });
        }

        var unDone = function () {
            parent.parent.addTabs("待办任务", "../Extend/YUIList.aspx?entity=V_HF_TaskInstanceView&functionID=17eae1ad-6f95-44bb-a231-3bfb8276ae81&order=taskStartTime desc");
        }
        
        var fnOpenDetail = function () {
            parent.parent.addTabs("考勤确认", "../Extend/YUIDataTableList.aspx?entity=V_wkWorkResult&order=WorkDate desc&functionID=46b2b874-c1ce-4807-a5f1-5a08b57699b3&condition=IsValidate='N' and WkStatus not in ('正常出勤','非工作日','项目中','加班')");
        }

        var fnOpenDetailLocation = function () {
            window.location = "../../Extend/YUIDataTableList.aspx?entity=V_wkWorkResult&order=WorkDate desc&functionID=46b2b874-c1ce-4807-a5f1-5a08b57699b3&condition=IsValidate='N' and WkStatus not in ('正常出勤','非工作日','项目中','加班')";
        }

        var ShowAnnounce = function (title, announceId) {
            parent.addTabs
            parent.parent.addTabs(title, "http://" + this.location.host + "/EditWidows/SysManager/ShowAnnounce.aspx?ID=" + announceId + "&r=" + Math.random() + "");
        }
        var fn_ShowMoreMessage = function ()
        {
            parent.parent.addTabs("更多消息", "../Extend/YUIList.aspx?entity=V_Message&order=SendTime desc&functionID=3fa9d909-c7c1-4dae-91a7-be904d4d905e");
        }
        var fn_ShowHistoryMessage = function ()
        {
            parent.parent.addTabs("查看历史消息", "../Extend/YUIList.aspx?entity=V_MessageHistory&order=SendTime desc&functionID=3fa9d909-c7c1-4dae-91a7-be904d4d905e");
        }

//        $.ready(function () {
//            //setTimeout(hideMsg, 1500);
//        });
//        function hideMsg() {
//            $("#divwk").hide();
        //        }
        var ViewDeptChart = function () {
            var url = "../Extend/Reports/hrDeskReports.aspx?flag=deptEmpCount&r=" + Math.random();
            var pagetitle = "在职人数统计";
            parent.parent.addTabs(pagetitle, url);
            parent.parent.NeedRefreshPage = this;
        }
       
    </script>

</head>
<body onload='load();'>
    
    <form id="form1" runat="server">
    <asp:HiddenField ID="frmHide" runat="server" />
    <!--默认模块-->
    <div id="customSetting">
        <div class="content">
            <asp:Label ID="lblContent" runat="server"></asp:Label>
        </div>
    </div>
    </form>
</body>
</html>